using Ardalis.Specification;

namespace Domain.Todos.Specifications;

/// <summary>
/// 待完成待办事项规约
/// </summary>
public sealed class PendingTodosSpecification : Specification<TodoItem>
{
    public PendingTodosSpecification(Guid userId)
    {
        Query.Where(todo => todo.UserId == userId && !todo.IsCompleted)
             .OrderBy(todo => todo.DueDate ?? DateTime.MaxValue)
             .ThenByDescending(todo => todo.Priority);
    }
}
